<?php
include("./API.php");
include("../config.php");
tongji("usern");
header("Content-type: text/html; charset=utf-8");
$msg=$_GET["msg"]?:"情侣";//输(选填：个性，情侣，非主流，英文，伤感，女生，男生，姐妹，兄弟，唯美，搞笑，游戏，超拽，霸气，可爱，小清新，空间，繁体字，符号，经典，文艺，励志，重口味，古风，简单，诗意，内涵，颓废，意境，帅气，家族，成熟，给力，忧伤，爱情，兄妹，小孩，战队)
$hh=$_GET["hh"]?:"\n";//换行符号(默认\n)
$type=array(
"情侣"=>array("m"=>"qinglv","max"=>984),
"个性"=>array("m"=>"gexing","max"=>579),
"非主流"=>array("m"=>"feizhuliu","max"=>633),
"英文"=>array("m"=>"yingwen","max"=>333),
"伤感"=>array("m"=>"shanggan","max"=>634),
"女生"=>array("m"=>"nvsheng","max"=>1172),
"男生"=>array("m"=>"nansheng","max"=>872),
"姐妹"=>array("m"=>"jiemei","max"=>133),
"兄弟"=>array("m"=>"xiongdi","max"=>61),
"唯美"=>array("m"=>"weimei","max"=>256),
"搞笑"=>array("m"=>"gaoxiao","max"=>419),
"游戏"=>array("m"=>"youxi","max"=>233),
"超拽"=>array("m"=>"chaozhuai","max"=>331),
"霸气"=>array("m"=>"baqi","max"=>237),
"可爱"=>array("m"=>"keai","max"=>425),
"小清新"=>array("m"=>"xiaoqingxin","max"=>121),
"空间"=>array("m"=>"kongjian","max"=>1412),
"繁体字"=>array("m"=>"fantizi","max"=>376),
"符号"=>array("m"=>"fuhao","max"=>179),
"经典"=>array("m"=>"jingdian","max"=>213),
"文艺"=>array("m"=>"wenyi","max"=>281),
"励志"=>array("m"=>"lizhi","max"=>75),
"重口味"=>array("m"=>"zhongkouwei","max"=>64),
"古风"=>array("m"=>"gufeng","max"=>202),
"简单"=>array("m"=>"jiandan","max"=>581),
"诗意"=>array("m"=>"shiyi","max"=>143),
"内涵"=>array("m"=>"neihan","max"=>97),
"颓废"=>array("m"=>"tuifei","max"=>124),
"意境"=>array("m"=>"yijing","max"=>203),
"帅气"=>array("m"=>"shuaiqi","max"=>106),
"家族"=>array("m"=>"jiazu","max"=>32),
"成熟"=>array("m"=>"chengshu","max"=>60),
"给力"=>array("m"=>"geili","max"=>80),
"忧伤"=>array("m"=>"youshang","max"=>372),
"爱情"=>array("m"=>"aiqing","max"=>589),
"兄妹"=>array("m"=>"xiongmei","max"=>43),
"小孩"=>array("m"=>"xiaohai","max"=>163),
"战队"=>array("m"=>"zhandui","max"=>78),
);
if($type[$msg]!=null||$type[$msg]!=''){
$data=curl("http://m.oicq88.com/".$type[$msg]["m"]."/".rand(1,$type[$msg]["max"]).".htm");
$data=DeleteHtml($data);
preg_match_all("/<ul>(.*?)<\/ul>/",$data,$data);
preg_match_all("/<li>(.*?)<\/li>/",$data[1][0],$data);
$rand=rand(0,count($data[1])-1);
$name=$data[1][$rand];
$name=str_replace("</p><p>", "\n", $name);
$name=str_replace("<p>", "", $name);
$name=str_replace("</p>", "", $name);
echo "".$web["ming"]."API个性网名".$hh."";
echo "━━━━━━━━━".$hh."";
echo "".$name."".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";

}else{
echo "".$web["ming"]."API个性网名".$hh."";
echo "━━━━━━━━━".$hh."";
echo "暂无".$msg."类型的网名，请输入正确的网名类型".$hh."";
echo "━━━━━━━━━".$hh."";
echo "Tips:".$web["ming"]."API技术支持";
}

function DeleteHtml($str) { 
    $str = trim($str); //清除字符串两边的空格
    $str = preg_replace("/\t/","",$str); //使用正则表达式替换内容，如：空格，换行，并将替换为空。
    $str = preg_replace("/\r\n/","",$str); 
    $str = preg_replace("/\r/","",$str); 
    $str = preg_replace("/\n/","",$str); 
    $str = preg_replace("/ /","",$str);
    $str = preg_replace("/  /","",$str);  //匹配html中的空格
    return trim($str); //返回字符串
}
?>